Developer Documentation

QuickTime 4 API Documentation

3D Graphics Programming with QuickDraw 3D 1.5.4

Previous | QD3D Book | Overview | Chapter Contents | Next |

Updating Viewer Data

The 3D Viewer provides routines that you can use to update the file or memory copy of the 3D data displayed in a viewer.

Q3ViewerWriteFile

You can use the Q3ViewerWriteFile function to update the file data being displayed in a viewer.

MAC OS VERSION

OSErr Q3ViewerWriteFile (
                     TQ3ViewerObject    theViewer,
                     long               refNum);

WINDOWS VERSION

TQ3Status Q3WinViewerWriteFile (
                     TQ3ViewerObject viewer,
                     HANDLE fileHandle);

PARAMETERS

theViewer
A viewer object.
refnum
The file reference number of an open file.
fileHandle
A handle to an open file.

DESCRIPTION

The Q3ViewerWriteFile function writes the 3D data currently associated with the viewer object specified by the theViewer parameter in 3DMF format to the file specified by the refnum parameter. If the kQ3ViewerOutputTextMode flag has been set, the 3DMF data is written out in text mode; otherwise, it is written out in binary mode.

If the camera viewpoint has been modified, a new camera is added to the 3D metafile data's view hints.

Q3ViewerWriteData

You can use the Q3ViewerWriteData function to update the memory data being displayed in a viewer.

MAC OS VERSION

unsigned long Q3ViewerWriteData (
                     TQ3ViewerObject    theViewer,
                     void               **data);

WINDOWS VERSION

TQ3Status Q3WinViewerWriteData (
                     TQ3ViewerObject viewer,
                     void *data,
                     unsigned long dataSize,
                     unsigned long *actualDataSize );

PARAMETERS

theViewer
A viewer object.
data
On exit, a pointer to the beginning of a block of 3DMF data that describes the model currently displayed in the specified viewer object. This block of memory is allocated by the 3D Viewer and is automatically disposed of when your application destroys its last viewer object.
dataSize
On entry, an unsigned long integer that specifies the size, in bytes, of the buffer pointed to by the data parameter.
actualDataSize
On exit, a pointer to a long integer that is set to the number of bytes actually copied into the buffer.

DESCRIPTION

The Q3ViewerWriteData function allocates a block of memory large enough to hold a 3DMF description of the model currently displayed in the viewer object specified by the theViewer parameter, writes that description into the block of memory, and returns the address of that block of memory in the data parameter. The Mac OS version of Q3ViewerWriteData returns, as its function result, the size (in bytes) of that block of memory.

If the kQ3ViewerOutputTextMode flag has been set, the 3DMF data is written out in text mode; otherwise, it is written out in binary mode.

If the camera viewpoint has been modified, a new camera is added to the 3DMF data's view hints.

SPECIAL CONSIDERATIONS

The block of memory that contains the 3D data is allocated by the 3D Viewer and must not be disposed of by your application. You should copy the 3D data into your own storage if you will need to access it after all viewer objects created by your application have been destroyed.


© 1997 Apple Computer, Inc.

Previous | QD3D Book | Overview | Chapter Contents | Next |